import java.util.concurrent.TimeUnit;

public class T06 {
  String name;
  double balance;
  
  public synchronized void set(String name, double balance) {
    this.name = name;
    
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    
    this.balance = balance;
  }
  
  public double getBalance(String name) {
    return this.balance;
  }
  
  public static void main(String[] args) {
    T06 t = new T06();
    new Thread(() -> t.set("lihh", 100)).start();
    
    try {
      TimeUnit.SECONDS.sleep(1);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    System.out.println(t.getBalance("lihh"));
    
    try {
      TimeUnit.SECONDS.sleep(2);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    
    System.out.println(t.getBalance("lihh"));
  }
}
